package com.razorfish.configuration.entities 
{
	import flash.display.Stage;
	import flash.system.Capabilities;
	import flash.utils.Dictionary;
	/**
	 * ...
	 * @author derek
	 */
	public class PredefinedProperty extends ConfigObject
	{
		private static const swfPath:String = "swfPath";
		private static const sitePath:String = "sitePath";
		private static const screenWidth:String = "screenWidth";
		private static const screenHeight:String = "screenHeight";
		private static const playerType:String = "playerType";
		private static const playerVersion:String = "playerVersion";
		
		private static var _propList:Array = [ swfPath, sitePath, screenWidth, screenHeight, playerType, playerVersion ];
		private static var _dict:Dictionary;
		
		public static function isDefined(prop:String):Boolean
		{
			if (_dict == null || prop == null) return false;
			return _propList.indexOf(prop) > -1;
		}
		
		public static function getProperty(prop:String):String
		{
			if (isDefined(prop))
				return _dict[prop];
				
			return null;
		}
		
		public static function init(stage:Stage = null):void
		{
			_dict = new Dictionary();
			_dict[screenWidth] = Capabilities.screenResolutionX.toString();
			_dict[screenHeight] = Capabilities.screenResolutionY.toString();
			_dict[playerType] = Capabilities.playerType;
			_dict[playerVersion] = Capabilities.version;
			
			if (stage)
			{
				_dict[sitePath] = stage.loaderInfo.url;
				_dict[swfPath] = stage.loaderInfo.loaderURL;
			}
			
			for (var key:String in _dict)
			{
				trace(key, ":", _dict[key]);
			}
		}
	}
}
